# Recipe postgresql::default

node['postgresql']['packages'].each do |pkg|
  package pkg do 
    action :install
  end
end

script "Initializing PostgreSQL Database" do
  interpreter "bash"
  user "root"
  code <<-EOF
    service postgresql initdb
  EOF
  not_if {::File.exists?("/var/lib/pgsql/data/postgresql.conf")}
end

service node['postgresql']['service'] do
  supports :restart => true, :reload => true, :initdb => true
  action [:enable, :start]
end
